package com.yang.sso.resource.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yang.common.core.result.R;

/**
 * @author zhouyang
 * @version v1.1
 * @date 2024/9/25 00:07
 * @description
 */
@RestController
public class MessagesController {

    @GetMapping("/messages1")
    public R<?> getMessages1() {
        return R.fail("测试机");
    }

    @GetMapping("/messages2")
    @PreAuthorize("hasAuthority('SCOPE_profile')")
    public String getMessages2() {
        return " hello Message 2";
    }

    @GetMapping("/messages3")
    @PreAuthorize("hasAuthority('SCOPE_Message')")
    public String getMessages3() {
        return " hello Message 3";
    }

    @GetMapping("/messages4")
    @PreAuthorize("hasAuthority('ROLE_USER')")
    public String getMessages4() {
        return " hello Message 4";
    }
}
